﻿namespace ExamV5.LineStudyExam
{
    using ExamV5;
    using System;
    using System.Configuration;
    using System.Data;
    using System.Data.SqlClient;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;

    public class AddTestPaper : Page
    {
        protected Button butDefault;
        protected Button butShowRubricCount;
        protected DropDownList DDLDiffculty;
        protected DropDownList DDLEndH;
        protected DropDownList DDLEndM;
        protected DropDownList DDLPaperTemplet;
        protected DropDownList DDLStartH;
        protected DropDownList DDLStartM;
        protected HtmlForm Form1;
        protected HtmlHead Head1;
        private HttpCookie httpCookie_0 = null;
        private HttpCookie httpCookie_1 = null;
        private HttpCookie httpCookie_2 = null;
        private HttpCookie httpCookie_3 = null;
        protected Label labRubricAFenTip;
        protected Label labRubricASumTip;
        protected Label labRubricBFenTip;
        protected Label labRubricBSumTip;
        protected Label labRubricCFenTip;
        protected Label labRubricCSumTip;
        protected Label labRubricDFenTip;
        protected Label labRubricDSumTip;
        protected Label labRubricEFenTip;
        protected Label labRubricESumTip;
        protected Label labRubricFFenTip;
        protected Label labRubricFSumTip;
        protected Label labRubricGFenTip;
        protected Label labRubricGSumTip;
        protected Label labRubricHFenTip;
        protected Label labRubricHSumTip;
        protected Label labRubricIFenTip;
        protected Label labRubricISumTip;
        protected Label labRubricJFenTip;
        protected Label labRubricJSumTip;
        protected Label labSumA;
        protected Label labSumB;
        protected Label labSumC;
        protected Label labSumD;
        protected Label labSumE;
        protected Label labSumF;
        protected Label labSumG;
        protected Label labSumH;
        protected Label labSumI;
        protected Label labSumJ;
        private PublicFun publicFun_0 = new PublicFun();
        protected RadioButtonList RBLExamShow;
        protected RadioButtonList RBLRubricShow;
        protected ScriptManager SM;
        protected string strSubjectID = "";
        protected string strSubjectName = "";
        protected TextBox txtAErrFen;
        protected TextBox txtANoWriteFen;
        protected TextBox txtBErrFen;
        protected TextBox txtBNoWriteFen;
        protected TextBox txtCErrFen;
        protected TextBox txtCNoWriteFen;
        protected TextBox txtEndDate;
        protected TextBox txtEndIP;
        protected TextBox txtExamName;
        protected TextBox txtExamTime;
        protected TextBox txtPaperSumFen;
        protected TextBox txtRubricAFen;
        protected TextBox txtRubricAMemo;
        protected TextBox txtRubricASum;
        protected TextBox txtRubricATip;
        protected TextBox txtRubricBFen;
        protected TextBox txtRubricBMemo;
        protected TextBox txtRubricBSum;
        protected TextBox txtRubricBTip;
        protected TextBox txtRubricCFen;
        protected TextBox txtRubricCMemo;
        protected TextBox txtRubricCSum;
        protected TextBox txtRubricCTip;
        protected TextBox txtRubricDFen;
        protected TextBox txtRubricDMemo;
        protected TextBox txtRubricDSum;
        protected TextBox txtRubricDTip;
        protected TextBox txtRubricEFen;
        protected TextBox txtRubricEMemo;
        protected TextBox txtRubricESum;
        protected TextBox txtRubricETip;
        protected TextBox txtRubricFFen;
        protected TextBox txtRubricFMemo;
        protected TextBox txtRubricFSum;
        protected TextBox txtRubricFTip;
        protected TextBox txtRubricGFen;
        protected TextBox txtRubricGMemo;
        protected TextBox txtRubricGSum;
        protected TextBox txtRubricGTip;
        protected TextBox txtRubricHFen;
        protected TextBox txtRubricHMemo;
        protected TextBox txtRubricHSum;
        protected TextBox txtRubricHTip;
        protected TextBox txtRubricIFen;
        protected TextBox txtRubricIMemo;
        protected TextBox txtRubricISum;
        protected TextBox txtRubricITip;
        protected TextBox txtRubricJFen;
        protected TextBox txtRubricJMemo;
        protected TextBox txtRubricJSum;
        protected TextBox txtRubricJTip;
        protected TextBox txtStartDate;
        protected TextBox txtStartIP;
        protected TextBox txtSumJRubricType;
        protected UpdatePanel UPPart;

        protected void butDefault_Click(object sender, EventArgs e)
        {
            string strSql = "";
            int num = 0;
            int num2 = 0;
            double num3 = 0.0;
            int num4 = 0;
            double num5 = 0.0;
            int num6 = 0;
            double num7 = 0.0;
            int num8 = 0;
            double num9 = 0.0;
            int num10 = 0;
            double num11 = 0.0;
            int num12 = 0;
            double num13 = 0.0;
            int num14 = 0;
            double num15 = 0.0;
            int num16 = 0;
            double num17 = 0.0;
            int num18 = 0;
            double num19 = 0.0;
            int num20 = 0;
            string str2 = "";
            string str3 = "A";
            string str4 = "N";
            double num21 = 0.0;
            double num22 = 0.0;
            double num23 = 0.0;
            double num24 = 0.0;
            double num25 = 0.0;
            double num26 = 0.0;
            try
            {
                num = Convert.ToInt32(this.txtPaperSumFen.Text.Trim());
            }
            catch
            {
                ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput1", "alert('试卷总分输入不合法！')", true);
                return;
            }
            if (num <= 0)
            {
                ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInputA1", "alert('试卷总分输入不合法！')", true);
            }
            else if (this.txtRubricASum.Text.Trim() == "")
            {
                ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput2", "alert('请输入" + this.txtRubricATip.Text + "题数！')", true);
            }
            else
            {
                try
                {
                    num2 = Convert.ToInt32(this.txtRubricASum.Text.Trim());
                }
                catch
                {
                    ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput3", "alert('" + this.txtRubricATip.Text + "题数输入不合法！')", true);
                    return;
                }
                if (this.txtRubricAFen.Text.Trim() == "")
                {
                    ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput4", "alert('请输入" + this.txtRubricATip.Text + "分值！')", true);
                }
                else
                {
                    try
                    {
                        num3 = Convert.ToDouble(this.txtRubricAFen.Text.Trim());
                    }
                    catch
                    {
                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput5", "alert('" + this.txtRubricATip.Text + "分值不合法！')", true);
                        return;
                    }
                    try
                    {
                        num24 = Convert.ToDouble(this.txtANoWriteFen.Text.Trim());
                    }
                    catch
                    {
                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInputNoWriteA", "alert('" + this.txtRubricATip.Text + "未答倒扣分值不合法！')", true);
                        return;
                    }
                    try
                    {
                        num21 = Convert.ToDouble(this.txtAErrFen.Text.Trim());
                    }
                    catch
                    {
                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInputErrFenA", "alert('" + this.txtRubricATip.Text + "答错倒扣分值不合法！')", true);
                        return;
                    }
                    if (this.txtRubricBSum.Text.Trim() == "")
                    {
                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput6", "alert('请输入" + this.txtRubricBTip.Text + "题数！')", true);
                    }
                    else
                    {
                        try
                        {
                            num4 = Convert.ToInt32(this.txtRubricBSum.Text.Trim());
                        }
                        catch
                        {
                            ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput7", "alert('" + this.txtRubricBTip.Text + "题数输入不合法！')", true);
                            return;
                        }
                        if (this.txtRubricBFen.Text.Trim() == "")
                        {
                            ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput8", "alert('请输入" + this.txtRubricBTip.Text + "分值！')", true);
                        }
                        else
                        {
                            try
                            {
                                num5 = Convert.ToDouble(this.txtRubricBFen.Text.Trim());
                            }
                            catch
                            {
                                ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput9", "alert('" + this.txtRubricBTip.Text + "分值不合法！')", true);
                                return;
                            }
                            try
                            {
                                num25 = Convert.ToDouble(this.txtBNoWriteFen.Text.Trim());
                            }
                            catch
                            {
                                ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BNoWriteB", "alert('" + this.txtRubricBTip.Text + "未答倒扣分值不合法！')", true);
                                return;
                            }
                            try
                            {
                                num22 = Convert.ToDouble(this.txtBErrFen.Text.Trim());
                            }
                            catch
                            {
                                ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BErrFenB", "alert('" + this.txtRubricBTip.Text + "答错倒扣分值不合法！')", true);
                                return;
                            }
                            if (this.txtRubricCSum.Text.Trim() == "")
                            {
                                ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput10", "alert('请输入" + this.txtRubricCTip.Text + "题数！')", true);
                            }
                            else
                            {
                                try
                                {
                                    num6 = Convert.ToInt32(this.txtRubricCSum.Text.Trim());
                                }
                                catch
                                {
                                    ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput11", "alert('" + this.txtRubricCTip.Text + "题数输入不合法！')", true);
                                    return;
                                }
                                if (this.txtRubricCFen.Text.Trim() == "")
                                {
                                    ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput12", "alert('请输入" + this.txtRubricCTip.Text + "分值！')", true);
                                }
                                else
                                {
                                    try
                                    {
                                        num7 = Convert.ToDouble(this.txtRubricCFen.Text.Trim());
                                    }
                                    catch
                                    {
                                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput13", "alert('" + this.txtRubricCTip.Text + "分值不合法！')", true);
                                        return;
                                    }
                                    try
                                    {
                                        num26 = Convert.ToDouble(this.txtCNoWriteFen.Text.Trim());
                                    }
                                    catch
                                    {
                                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BNoWriteC", "alert('" + this.txtRubricCTip.Text + "未答倒扣分值不合法！')", true);
                                        return;
                                    }
                                    try
                                    {
                                        num23 = Convert.ToDouble(this.txtCErrFen.Text.Trim());
                                    }
                                    catch
                                    {
                                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BErrFenC", "alert('" + this.txtRubricCTip.Text + "答错倒扣分值不合法！')", true);
                                        return;
                                    }
                                    if (this.txtRubricDSum.Text.Trim() == "")
                                    {
                                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput14", "alert('请输入" + this.txtRubricDTip.Text + "题数！')", true);
                                    }
                                    else
                                    {
                                        try
                                        {
                                            num8 = Convert.ToInt32(this.txtRubricDSum.Text.Trim());
                                        }
                                        catch
                                        {
                                            ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput15", "alert('" + this.txtRubricDTip.Text + "题数输入不合法！')", true);
                                            return;
                                        }
                                        if (this.txtRubricDFen.Text.Trim() == "")
                                        {
                                            ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput16", "alert('请输入" + this.txtRubricDTip.Text + "分值！')", true);
                                        }
                                        else
                                        {
                                            try
                                            {
                                                num9 = Convert.ToDouble(this.txtRubricDFen.Text.Trim());
                                            }
                                            catch
                                            {
                                                ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput17", "alert('" + this.txtRubricDTip.Text + "分值不合法！')", true);
                                                return;
                                            }
                                            if (this.txtRubricESum.Text.Trim() == "")
                                            {
                                                ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput18", "alert('请输入" + this.txtRubricETip.Text + "题数！')", true);
                                            }
                                            else
                                            {
                                                try
                                                {
                                                    num10 = Convert.ToInt32(this.txtRubricESum.Text.Trim());
                                                }
                                                catch
                                                {
                                                    ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput19", "alert('" + this.txtRubricETip.Text + "题数输入不合法！')", true);
                                                    return;
                                                }
                                                if (this.txtRubricEFen.Text.Trim() == "")
                                                {
                                                    ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput20", "alert('请输入" + this.txtRubricETip.Text + "分值！')", true);
                                                }
                                                else
                                                {
                                                    try
                                                    {
                                                        num11 = Convert.ToDouble(this.txtRubricEFen.Text.Trim());
                                                    }
                                                    catch
                                                    {
                                                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput21", "alert('" + this.txtRubricETip.Text + "分值不合法！')", true);
                                                        return;
                                                    }
                                                    if (this.txtRubricFSum.Text.Trim() == "")
                                                    {
                                                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput22", "alert('请输入" + this.txtRubricFTip.Text + "题数！')", true);
                                                    }
                                                    else
                                                    {
                                                        try
                                                        {
                                                            num12 = Convert.ToInt32(this.txtRubricFSum.Text.Trim());
                                                        }
                                                        catch
                                                        {
                                                            ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput23", "alert('" + this.txtRubricFTip.Text + "题数输入不合法！')", true);
                                                            return;
                                                        }
                                                        if (this.txtRubricFFen.Text.Trim() == "")
                                                        {
                                                            ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput24", "alert('请输入" + this.txtRubricFTip.Text + "分值！')", true);
                                                        }
                                                        else
                                                        {
                                                            try
                                                            {
                                                                num13 = Convert.ToDouble(this.txtRubricFFen.Text.Trim());
                                                            }
                                                            catch
                                                            {
                                                                ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput25", "alert('" + this.txtRubricFTip.Text + "分值不合法！')", true);
                                                                return;
                                                            }
                                                            if (this.txtRubricGSum.Text.Trim() == "")
                                                            {
                                                                ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput26", "alert('请输入" + this.txtRubricGTip.Text + "题数！')", true);
                                                            }
                                                            else
                                                            {
                                                                try
                                                                {
                                                                    num14 = Convert.ToInt32(this.txtRubricGSum.Text.Trim());
                                                                }
                                                                catch
                                                                {
                                                                    ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput27", "alert('" + this.txtRubricGTip.Text + "题数输入不合法！')", true);
                                                                    return;
                                                                }
                                                                if (this.txtRubricGFen.Text.Trim() == "")
                                                                {
                                                                    ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput28", "alert('请输入" + this.txtRubricGTip.Text + "分值！')", true);
                                                                }
                                                                else
                                                                {
                                                                    try
                                                                    {
                                                                        num15 = Convert.ToDouble(this.txtRubricGFen.Text.Trim());
                                                                    }
                                                                    catch
                                                                    {
                                                                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput29", "alert('" + this.txtRubricGTip.Text + "分值不合法！')", true);
                                                                        return;
                                                                    }
                                                                    if (this.txtRubricHSum.Text.Trim() == "")
                                                                    {
                                                                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput30", "alert('请输入" + this.txtRubricHTip.Text + "题数！')", true);
                                                                    }
                                                                    else
                                                                    {
                                                                        try
                                                                        {
                                                                            num16 = Convert.ToInt32(this.txtRubricHSum.Text.Trim());
                                                                        }
                                                                        catch
                                                                        {
                                                                            ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput31", "alert('" + this.txtRubricHTip.Text + "题数输入不合法！')", true);
                                                                            return;
                                                                        }
                                                                        if (this.txtRubricHFen.Text.Trim() == "")
                                                                        {
                                                                            ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput32", "alert('请输入" + this.txtRubricHTip.Text + "分值！')", true);
                                                                        }
                                                                        else
                                                                        {
                                                                            try
                                                                            {
                                                                                num17 = Convert.ToDouble(this.txtRubricHFen.Text.Trim());
                                                                            }
                                                                            catch
                                                                            {
                                                                                ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput33", "alert('" + this.txtRubricHTip.Text + "分值不合法！')", true);
                                                                                return;
                                                                            }
                                                                            if (this.txtRubricISum.Text.Trim() == "")
                                                                            {
                                                                                ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput34", "alert('请输入" + this.txtRubricITip.Text + "题数！')", true);
                                                                            }
                                                                            else
                                                                            {
                                                                                try
                                                                                {
                                                                                    num18 = Convert.ToInt32(this.txtRubricISum.Text.Trim());
                                                                                }
                                                                                catch
                                                                                {
                                                                                    ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput35", "alert('" + this.txtRubricITip.Text + "题数输入不合法！')", true);
                                                                                    return;
                                                                                }
                                                                                if (this.txtRubricIFen.Text.Trim() == "")
                                                                                {
                                                                                    ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput36", "alert('请输入" + this.txtRubricITip.Text + "分值！')", true);
                                                                                }
                                                                                else
                                                                                {
                                                                                    try
                                                                                    {
                                                                                        num19 = Convert.ToDouble(this.txtRubricIFen.Text.Trim());
                                                                                    }
                                                                                    catch
                                                                                    {
                                                                                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput37", "alert('" + this.txtRubricITip.Text + "分值不合法！')", true);
                                                                                        return;
                                                                                    }
                                                                                    try
                                                                                    {
                                                                                        num20 = Convert.ToInt32(this.txtExamTime.Text.Trim());
                                                                                    }
                                                                                    catch
                                                                                    {
                                                                                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput38", "alert('考试时间输入不合法！')", true);
                                                                                        return;
                                                                                    }
                                                                                    if (Convert.ToDateTime(this.txtStartDate.Text) > Convert.ToDateTime(this.txtEndDate.Text))
                                                                                    {
                                                                                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput39", "alert('考试有效期限不合法！')", true);
                                                                                    }
                                                                                    else
                                                                                    {
                                                                                        double num29 = 0.0;
                                                                                        string str17 = "正规试题";
                                                                                        num29 = ((((((((num2 * num3) + (num4 * num5)) + (num6 * num7)) + (num8 * num9)) + (num10 * num11)) + (num12 * num13)) + (num14 * num15)) + (num16 * num17)) + (num18 * num19);
                                                                                        num29 += Convert.ToDouble(this.txtSumJRubricType.Text.Trim());
                                                                                        if (num != Convert.ToInt16(num29))
                                                                                        {
                                                                                            ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput40", "alert('试卷总分与题型分值总和不一致！')", true);
                                                                                        }
                                                                                        else
                                                                                        {
                                                                                            str2 = "";
                                                                                            str4 = "N";
                                                                                            str3 = "C";
                                                                                            str17 = "模拟试题";
                                                                                            string[] strArray3 = this.txtStartIP.Text.Trim().Split(new char[] { '.' });
                                                                                            string[] strArray4 = this.txtEndIP.Text.Trim().Split(new char[] { '.' });
                                                                                            if (strArray3.Length != 4)
                                                                                            {
                                                                                                ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput25", "alert('IP地址不合法！')", true);
                                                                                            }
                                                                                            else if (strArray4.Length != 4)
                                                                                            {
                                                                                                ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput25", "alert('IP地址不合法！')", true);
                                                                                            }
                                                                                            else
                                                                                            {
                                                                                                int num28;
                                                                                                for (num28 = 0; num28 < strArray3.Length; num28++)
                                                                                                {
                                                                                                    if ((((int.Parse(strArray3[num28]) < 0) || (int.Parse(strArray3[num28]) > 0xff)) || (int.Parse(strArray4[num28]) < 0)) || (int.Parse(strArray4[num28]) > 0xff))
                                                                                                    {
                                                                                                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInput25", "alert('IP地址不合法！')", true);
                                                                                                        return;
                                                                                                    }
                                                                                                }
                                                                                                this.strSubjectName = base.Request.Form["txtSubjectName"].ToString().Trim().Replace("│", "").Replace("├", "");
                                                                                                this.strSubjectID = base.Request.Form["txtSubjectID"].ToString().Trim();
                                                                                                string[] strArray2 = this.strSubjectID.Split(new char[] { ',' });
                                                                                                string str6 = "";
                                                                                                for (num28 = 0; num28 < strArray2.Length; num28++)
                                                                                                {
                                                                                                    if (strArray2[num28].Trim() != "")
                                                                                                    {
                                                                                                        if (str6.Trim().Length != 0)
                                                                                                        {
                                                                                                            str6 = str6 + " or SubjectID='" + strArray2[num28].Trim() + "' ";
                                                                                                        }
                                                                                                        else
                                                                                                        {
                                                                                                            str6 = " (SubjectID='" + strArray2[num28].Trim() + "' ";
                                                                                                        }
                                                                                                    }
                                                                                                }
                                                                                                if (str6.Trim() != "")
                                                                                                {
                                                                                                    str6 = str6 + ")";
                                                                                                }
                                                                                                else
                                                                                                {
                                                                                                    str6 = " ID<>0 ";
                                                                                                }
                                                                                                strSql = "select count(*) as RubricCount from RubricInfo where IsDel='N' and Flag='" + str3 + "' and ISCheck='N' and " + str6 + "  and (IsShare='A' or (IsShare='B' and CreatNumberNO='" + this.httpCookie_0.Value.Trim() + "'))";
                                                                                                if (num2 > 0)
                                                                                                {
                                                                                                    string str26 = strSql + " and RubricType='A'";
                                                                                                    if (num2 >= Convert.ToInt32(this.publicFun_0.GetValues(str26, "RubricCount")))
                                                                                                    {
                                                                                                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInputR1", "alert('" + str17 + "题库中的" + this.txtRubricATip.Text + "总数为:" + num2.ToString() + "道,随机抽题只能多抽少！')", true);
                                                                                                        return;
                                                                                                    }
                                                                                                }
                                                                                                if (num4 > 0)
                                                                                                {
                                                                                                    string str25 = strSql + " and RubricType='B'";
                                                                                                    if (num4 >= Convert.ToInt32(this.publicFun_0.GetValues(str25, "RubricCount")))
                                                                                                    {
                                                                                                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInputR2", "alert(" + str17 + "题库中的" + this.txtRubricBTip.Text + "总数为:" + num4.ToString() + "道,随机抽题只能多抽少！')", true);
                                                                                                        return;
                                                                                                    }
                                                                                                }
                                                                                                if (num6 > 0)
                                                                                                {
                                                                                                    string str24 = strSql + " and RubricType='C'";
                                                                                                    if (num6 >= Convert.ToInt32(this.publicFun_0.GetValues(str24, "RubricCount")))
                                                                                                    {
                                                                                                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInputR3", "alert('" + str17 + "题库中的" + this.txtRubricCTip.Text + "总数为:" + num6.ToString() + "道,随机抽题只能多抽少！')", true);
                                                                                                        return;
                                                                                                    }
                                                                                                }
                                                                                                if (num8 > 0)
                                                                                                {
                                                                                                    string str23 = strSql + " and RubricType='D'";
                                                                                                    if (num8 >= Convert.ToInt32(this.publicFun_0.GetValues(str23, "RubricCount")))
                                                                                                    {
                                                                                                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInputR4", "alert('" + str17 + "题库中的" + this.txtRubricDTip.Text + "总数为:" + num8.ToString() + "道,随机抽题只能多抽少！')", true);
                                                                                                        return;
                                                                                                    }
                                                                                                }
                                                                                                if (num10 > 0)
                                                                                                {
                                                                                                    string str22 = strSql + " and RubricType='E'";
                                                                                                    if (num10 >= Convert.ToInt32(this.publicFun_0.GetValues(str22, "RubricCount")))
                                                                                                    {
                                                                                                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInputR5", "alert('" + str17 + "题库中的" + this.txtRubricETip.Text + "总数为:" + num10.ToString() + "道,随机抽题只能多抽少！')", true);
                                                                                                        return;
                                                                                                    }
                                                                                                }
                                                                                                if (num12 > 0)
                                                                                                {
                                                                                                    string str21 = strSql + " and RubricType='F'";
                                                                                                    if (num12 >= Convert.ToInt32(this.publicFun_0.GetValues(str21, "RubricCount")))
                                                                                                    {
                                                                                                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInputR6", "alert('" + str17 + "题库中的" + this.txtRubricFTip.Text + "总数为:" + num12.ToString() + "道,随机抽题只能多抽少！')", true);
                                                                                                        return;
                                                                                                    }
                                                                                                }
                                                                                                if (num14 > 0)
                                                                                                {
                                                                                                    string str20 = strSql + " and RubricType='G'";
                                                                                                    if (num14 >= Convert.ToInt32(this.publicFun_0.GetValues(str20, "RubricCount")))
                                                                                                    {
                                                                                                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInputR7", "alert('" + str17 + "题库中的" + this.txtRubricGTip.Text + "总数为:" + num14.ToString() + "道,随机抽题只能多抽少！')", true);
                                                                                                        return;
                                                                                                    }
                                                                                                }
                                                                                                if (num16 > 0)
                                                                                                {
                                                                                                    string str19 = strSql + " and RubricType='H'";
                                                                                                    if (num16 >= Convert.ToInt32(this.publicFun_0.GetValues(str19, "RubricCount")))
                                                                                                    {
                                                                                                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInputR8", "alert('" + str17 + "题库中的" + this.txtRubricHTip.Text + "总数为:" + num16.ToString() + "道,随机抽题只能多抽少！')", true);
                                                                                                        return;
                                                                                                    }
                                                                                                }
                                                                                                if (num18 > 0)
                                                                                                {
                                                                                                    string str18 = strSql + " and RubricType='I'";
                                                                                                    if (num18 >= Convert.ToInt32(this.publicFun_0.GetValues(str18, "RubricCount")))
                                                                                                    {
                                                                                                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInputR9", "alert('" + str17 + "题库中的" + this.txtRubricITip.Text + "总数为:" + num18.ToString() + "道,随机抽题只能多抽少！')", true);
                                                                                                        return;
                                                                                                    }
                                                                                                }
                                                                                                string str9 = this.txtRubricATip.Text.Trim() + "#" + this.txtRubricBTip.Text.Trim() + "#" + this.txtRubricCTip.Text.Trim() + "#" + this.txtRubricDTip.Text.Trim() + "#" + this.txtRubricETip.Text.Trim() + "#" + this.txtRubricFTip.Text.Trim() + "#" + this.txtRubricGTip.Text.Trim() + "#" + this.txtRubricHTip.Text.Trim() + "#" + this.txtRubricITip.Text.Trim() + "#" + this.txtRubricJTip.Text.Trim();
                                                                                                string str5 = num2.ToString() + "#" + num4.ToString() + "#" + num6.ToString() + "#" + num8.ToString() + "#" + num10.ToString() + "#" + num12.ToString() + "#" + num14.ToString() + "#" + num16.ToString() + "#" + num18.ToString();
                                                                                                string str10 = num3.ToString() + "#" + num5.ToString() + "#" + num7.ToString() + "#" + num9.ToString() + "#" + num11.ToString() + "#" + num13.ToString() + "#" + num15.ToString() + "#" + num17.ToString() + "#" + num19.ToString();
                                                                                                string str11 = this.txtRubricAMemo.Text.Trim() + "#" + this.txtRubricBMemo.Text.Trim() + "#" + this.txtRubricCMemo.Text.Trim() + "#" + this.txtRubricDMemo.Text.Trim() + "#" + this.txtRubricEMemo.Text.Trim() + "#" + this.txtRubricFMemo.Text.Trim() + "#" + this.txtRubricGMemo.Text.Trim() + "#" + this.txtRubricHMemo.Text.Trim() + "#" + this.txtRubricIMemo.Text.Trim().Replace("#", "＃");
                                                                                                string str12 = this.txtStartDate.Text.Trim() + " " + this.DDLStartH.SelectedItem.Value + ":" + this.DDLStartM.SelectedItem.Value + ":00";
                                                                                                string str13 = this.txtEndDate.Text.Trim() + " " + this.DDLEndH.SelectedItem.Value + ":" + this.DDLEndM.SelectedItem.Value + ":00";
                                                                                                string str14 = num21.ToString() + "#" + num22.ToString() + "#" + num23.ToString() + "#######";
                                                                                                string str15 = num24.ToString() + "#" + num25.ToString() + "#" + num26.ToString() + "#######";
                                                                                                int sqlID = 0;
                                                                                                string str16 = "0";
                                                                                                string str7 = "1";
                                                                                                strSql = "insert into PaperInfo(EnterTime,NoWriteFen,ErrorFen,SubjectID,InputUserCode,StartIP,EndIP,IsShow,RubricTypeName,JoinExamNum,StudyPlanID,OutPutType,MemberFen,ExamName,SubjectName,PaperFen,PaperDiff,RubricDist,FenDist,MemoDist,ExamTime,PaperStartTime,PaperEndTime,IsCheck,CheckMan,Flag,PaperStatus,InputMan)";
                                                                                                strSql = string.Concat(new object[] { 
                                                                                                    strSql, " values('A','", str15, "','", str14, "','", this.strSubjectID, "','", this.httpCookie_0.Value, "','", this.txtStartIP.Text.Trim(), "','", this.txtEndIP.Text.Trim(), "','", this.RBLExamShow.SelectedItem.Value, "','", 
                                                                                                    str9, "',", 0, ",'0','", this.RBLRubricShow.SelectedItem.Value, "','", str16.Trim(), "','", this.publicFun_0.CheckString(this.txtExamName.Text), "','", this.strSubjectName.Trim().Replace(",", "、"), "',", num, ",'", this.DDLDiffculty.SelectedItem.Value, "','", 
                                                                                                    str5.Trim(), "#", this.txtRubricJSum.Text.Trim(), "','", str10.Trim(), "#", this.txtRubricJFen.Text.Trim(), "',"
                                                                                                 });
                                                                                                strSql = string.Concat(new object[] { 
                                                                                                    strSql, "'", str11.Trim(), "#", this.txtRubricJMemo.Text.Trim().Replace("#", "＃"), "',", num20, ",'", str12.Trim(), "','", str13.Trim(), "','", str4, "','", str2, "','A','C','", 
                                                                                                    this.httpCookie_1.Value, "')"
                                                                                                 });
                                                                                                sqlID = this.publicFun_0.GetSqlID(strSql);
                                                                                                if (sqlID != 0)
                                                                                                {
                                                                                                    if (this.method_2(sqlID, str5.Trim(), str6, str7) == 0)
                                                                                                    {
                                                                                                        string str8 = base.Request.Url.ToString();
                                                                                                        str8 = str8.Substring(0, str8.LastIndexOf('/') + 1);
                                                                                                        base.Response.Redirect(str8 + "TestExamList.aspx");
                                                                                                    }
                                                                                                    else
                                                                                                    {
                                                                                                        strSql = string.Concat(new object[] { "delete from GradeReule where PaperID=", sqlID, ";Delete from PaperInfo where ID=", sqlID, ";delete from SysTip where  Formtable='PaperInfo' and FormID=", sqlID });
                                                                                                        sqlID = this.publicFun_0.ExecuteSql(strSql);
                                                                                                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BInputR9", "alert('新建自我模拟试卷信息失败！')", true);
                                                                                                    }
                                                                                                }
                                                                                            }
                                                                                        }
                                                                                    }
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }

        protected void butShowRubricCount_Click(object sender, EventArgs e)
        {
            this.method_3();
        }

        protected void DDLPaperTemplet_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.DDLPaperTemplet.SelectedItem.Value != "0")
            {
                SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["Conn"].ConnectionString);
                SqlCommand command = new SqlCommand("select * from TemplatePaper where ID=" + this.DDLPaperTemplet.SelectedItem.Value, connection);
                connection.Open();
                SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);
                if (reader.Read())
                {
                    this.RBLExamShow.SelectedIndex = -1;
                    this.txtStartIP.Text = reader["StartIP"].ToString();
                    this.txtEndIP.Text = reader["EndIP"].ToString();
                    this.RBLExamShow.Items.FindByValue(reader["IsShow"].ToString()).Selected = true;
                    this.RBLRubricShow.SelectedIndex = -1;
                    this.RBLRubricShow.Items.FindByValue(reader["OutPutType"].ToString()).Selected = true;
                    this.DDLDiffculty.SelectedIndex = -1;
                    this.DDLDiffculty.Items.FindByValue(reader["Difficult"].ToString()).Selected = true;
                    this.txtPaperSumFen.Text = reader["PaperSumFen"].ToString();
                    this.txtExamTime.Text = reader["ExamTime"].ToString();
                    string[] strArray = reader["RubricDist"].ToString().Split(new char[] { '#' });
                    string[] strArray2 = reader["FenDist"].ToString().Split(new char[] { '#' });
                    string[] strArray3 = reader["MemoDist"].ToString().Split(new char[] { '#' });
                    this.txtRubricASum.Text = strArray[0];
                    this.txtRubricBSum.Text = strArray[1];
                    this.txtRubricCSum.Text = strArray[2];
                    this.txtRubricDSum.Text = strArray[3];
                    this.txtRubricESum.Text = strArray[4];
                    this.txtRubricFSum.Text = strArray[5];
                    this.txtRubricGSum.Text = strArray[6];
                    this.txtRubricHSum.Text = strArray[7];
                    this.txtRubricISum.Text = strArray[8];
                    this.txtRubricAFen.Text = strArray2[0];
                    this.txtRubricBFen.Text = strArray2[1];
                    this.txtRubricCFen.Text = strArray2[2];
                    this.txtRubricDFen.Text = strArray2[3];
                    this.txtRubricEFen.Text = strArray2[4];
                    this.txtRubricFFen.Text = strArray2[5];
                    this.txtRubricGFen.Text = strArray2[6];
                    this.txtRubricHFen.Text = strArray2[7];
                    this.txtRubricIFen.Text = strArray2[8];
                    this.txtRubricAMemo.Text = strArray3[0];
                    this.txtRubricBMemo.Text = strArray3[1];
                    this.txtRubricCMemo.Text = strArray3[2];
                    this.txtRubricDMemo.Text = strArray3[3];
                    this.txtRubricEMemo.Text = strArray3[4];
                    this.txtRubricFMemo.Text = strArray3[5];
                    this.txtRubricGMemo.Text = strArray3[6];
                    this.txtRubricHMemo.Text = strArray3[7];
                    this.txtRubricIMemo.Text = strArray3[8];
                    string[] strArray4 = reader["RubricTypeName"].ToString().Split(new char[] { '#' });
                    this.txtRubricATip.Text = strArray4[0].Trim();
                    this.txtRubricBTip.Text = strArray4[1].Trim();
                    this.txtRubricCTip.Text = strArray4[2].Trim();
                    this.txtRubricDTip.Text = strArray4[3].Trim();
                    this.txtRubricETip.Text = strArray4[4].Trim();
                    this.txtRubricFTip.Text = strArray4[5].Trim();
                    this.txtRubricGTip.Text = strArray4[6].Trim();
                    this.txtRubricHTip.Text = strArray4[7].Trim();
                    this.txtRubricITip.Text = strArray4[8].Trim();
                    string[] strArray5 = reader["NoWriteFen"].ToString().Split(new char[] { '#' });
                    string[] strArray6 = reader["ErrorFen"].ToString().Split(new char[] { '#' });
                    this.txtAErrFen.Text = strArray6[0].ToString();
                    this.txtBErrFen.Text = strArray6[1].ToString();
                    this.txtCErrFen.Text = strArray6[2].ToString();
                    this.txtANoWriteFen.Text = strArray5[0].ToString();
                    this.txtBNoWriteFen.Text = strArray5[1].ToString();
                    this.txtCNoWriteFen.Text = strArray5[2].ToString();
                }
                reader.Close();
                command.Dispose();
                connection.Close();
                connection.Dispose();
            }
        }

        private void method_0()
        {
            int num = 0;
            string cmdText = "select ParmName from SysParmInfo where ParmMemo='RubricType' order by ParmValue";
            SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["Conn"].ConnectionString);
            connection.Open();
            SqlCommand command = new SqlCommand(cmdText, connection);
            SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);
            while (reader.Read())
            {
                switch (num)
                {
                    case 0:
                        this.txtRubricATip.Text = reader["ParmName"].ToString();
                        break;

                    case 1:
                        this.txtRubricBTip.Text = reader["ParmName"].ToString();
                        break;

                    case 2:
                        this.txtRubricCTip.Text = reader["ParmName"].ToString();
                        break;

                    case 3:
                        this.txtRubricDTip.Text = reader["ParmName"].ToString();
                        break;

                    case 4:
                        this.txtRubricETip.Text = reader["ParmName"].ToString();
                        break;

                    case 5:
                        this.txtRubricFTip.Text = reader["ParmName"].ToString();
                        break;

                    case 6:
                        this.txtRubricGTip.Text = reader["ParmName"].ToString();
                        break;

                    case 7:
                        this.txtRubricHTip.Text = reader["ParmName"].ToString();
                        break;

                    case 8:
                        this.txtRubricITip.Text = reader["ParmName"].ToString();
                        break;

                    case 9:
                        this.txtRubricJTip.Text = reader["ParmName"].ToString();
                        break;
                }
                num++;
            }
            if (this.txtRubricATip.Text.Trim() == "")
            {
                this.txtRubricATip.Text = "单选题";
            }
            if (this.txtRubricBTip.Text.Trim() == "")
            {
                this.txtRubricBTip.Text = "多选题";
            }
            if (this.txtRubricCTip.Text.Trim() == "")
            {
                this.txtRubricCTip.Text = "判断题";
            }
            if (this.txtRubricDTip.Text.Trim() == "")
            {
                this.txtRubricDTip.Text = "填空题";
            }
            if (this.txtRubricETip.Text.Trim() == "")
            {
                this.txtRubricETip.Text = "简答题";
            }
            if (this.txtRubricFTip.Text.Trim() == "")
            {
                this.txtRubricFTip.Text = "作文题";
            }
            if (this.txtRubricGTip.Text.Trim() == "")
            {
                this.txtRubricGTip.Text = "论述题";
            }
            if (this.txtRubricHTip.Text.Trim() == "")
            {
                this.txtRubricHTip.Text = "分析题";
            }
            if (this.txtRubricITip.Text.Trim() == "")
            {
                this.txtRubricITip.Text = "操作题";
            }
            if (this.txtRubricJTip.Text.Trim() == "")
            {
                this.txtRubricJTip.Text = "综合题";
            }
            reader.Close();
            command.Dispose();
            connection.Close();
            connection.Dispose();
        }

        private void method_1()
        {
            string selectCommandText = "";
            selectCommandText = "select ID,TemplateName from TemplatePaper order by ID desc";
            SqlConnection selectConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["Conn"].ConnectionString);
            SqlDataAdapter adapter = new SqlDataAdapter(selectCommandText, selectConnection);
            DataSet dataSet = new DataSet();
            adapter.Fill(dataSet, "TemplatePaper");
            this.DDLPaperTemplet.DataTextField = "TemplateName";
            this.DDLPaperTemplet.DataValueField = "ID";
            this.DDLPaperTemplet.DataSource = dataSet.Tables["TemplatePaper"].DefaultView;
            this.DDLPaperTemplet.DataBind();
            adapter.Dispose();
            dataSet.Dispose();
            selectConnection.Dispose();
            this.DDLPaperTemplet.Items.Insert(0, new ListItem("--自定义试卷参数--", "0"));
        }

        private int method_2(int int_0, string string_0, string string_1, string string_2)
        {
            string str = "#";
            string str2 = "#";
            string str3 = "#";
            string str4 = "#";
            string str5 = "#";
            string str6 = "#";
            string str7 = "#";
            string str8 = "#";
            string str9 = "#";
            Random random = new Random();
            bool flag = true;
            string[] strArray = string_0.Split(new char[] { '#' });
            string str10 = "C";
            string strSql = "select ID from RubricInfo where Flag='" + str10 + "' and ISCheck='N' and " + string_1 + " and IsDel='N' ";
            if (!(string_2.Trim() == "1"))
            {
                strSql = strSql + "  and CreatNumberNO='" + this.httpCookie_0.Value.Trim() + "'";
            }
            else
            {
                strSql = strSql + "  and (IsShare='A' or (IsShare='B' and CreatNumberNO='" + this.httpCookie_0.Value.Trim() + "'))";
            }
            SqlConnection selectConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["Conn"].ConnectionString);
            DataSet dataSet = new DataSet();
            if (Convert.ToInt32(strArray[0]) > 0)
            {
                int num27 = Convert.ToInt32(strArray[0]);
                SqlDataAdapter adapter9 = new SqlDataAdapter(strSql + " and RubricType='A'", selectConnection);
                adapter9.Fill(dataSet, "AExamData");
                int count = dataSet.Tables["AExamData"].Rows.Count;
                while (flag)
                {
                    if (num27 == 0)
                    {
                        break;
                    }
                    int num29 = random.Next(count);
                    string str29 = dataSet.Tables["AExamData"].Rows[num29]["ID"].ToString() + "#";
                    if (str.IndexOf("#" + str29, 0) == -1)
                    {
                        str = str + str29;
                        num27--;
                    }
                }
                dataSet.Tables.Clear();
                adapter9.Dispose();
            }
            if (Convert.ToInt32(strArray[1]) > 0)
            {
                int num24 = Convert.ToInt32(strArray[1]);
                SqlDataAdapter adapter8 = new SqlDataAdapter(strSql + " and RubricType='B'", selectConnection);
                adapter8.Fill(dataSet, "BExamData");
                int maxValue = dataSet.Tables["BExamData"].Rows.Count;
                while (flag)
                {
                    if (num24 == 0)
                    {
                        break;
                    }
                    int num26 = random.Next(maxValue);
                    string str27 = dataSet.Tables["BExamData"].Rows[num26]["ID"].ToString() + "#";
                    if (str2.IndexOf("#" + str27, 0) == -1)
                    {
                        str2 = str2 + str27;
                        num24--;
                    }
                }
                dataSet.Tables.Clear();
                adapter8.Dispose();
            }
            if (Convert.ToInt32(strArray[2]) > 0)
            {
                int num21 = Convert.ToInt32(strArray[2]);
                SqlDataAdapter adapter7 = new SqlDataAdapter(strSql + " and RubricType='C'", selectConnection);
                adapter7.Fill(dataSet, "CExamData");
                int num22 = dataSet.Tables["CExamData"].Rows.Count;
                while (flag)
                {
                    if (num21 == 0)
                    {
                        break;
                    }
                    int num23 = random.Next(num22);
                    string str25 = dataSet.Tables["CExamData"].Rows[num23]["ID"].ToString() + "#";
                    if (str3.IndexOf("#" + str25, 0) == -1)
                    {
                        str3 = str3 + str25;
                        num21--;
                    }
                }
                dataSet.Tables.Clear();
                adapter7.Dispose();
            }
            if (Convert.ToInt32(strArray[3]) > 0)
            {
                int num18 = Convert.ToInt32(strArray[3]);
                SqlDataAdapter adapter6 = new SqlDataAdapter(strSql + " and RubricType='D'", selectConnection);
                adapter6.Fill(dataSet, "DExamData");
                int num19 = dataSet.Tables["DExamData"].Rows.Count;
                while (flag)
                {
                    if (num18 == 0)
                    {
                        break;
                    }
                    int num20 = random.Next(num19);
                    string str23 = dataSet.Tables["DExamData"].Rows[num20]["ID"].ToString() + "#";
                    if (str4.IndexOf("#" + str23, 0) == -1)
                    {
                        str4 = str4 + str23;
                        num18--;
                    }
                }
                dataSet.Tables.Clear();
                adapter6.Dispose();
            }
            if (Convert.ToInt32(strArray[4]) > 0)
            {
                int num15 = Convert.ToInt32(strArray[4]);
                SqlDataAdapter adapter5 = new SqlDataAdapter(strSql + " and RubricType='E'", selectConnection);
                adapter5.Fill(dataSet, "EExamData");
                int num16 = dataSet.Tables["EExamData"].Rows.Count;
                while (flag)
                {
                    if (num15 == 0)
                    {
                        break;
                    }
                    int num17 = random.Next(num16);
                    string str21 = dataSet.Tables["EExamData"].Rows[num17]["ID"].ToString() + "#";
                    if (str5.IndexOf("#" + str21, 0) == -1)
                    {
                        str5 = str5 + str21;
                        num15--;
                    }
                }
                dataSet.Tables.Clear();
                adapter5.Dispose();
            }
            if (Convert.ToInt32(strArray[5]) > 0)
            {
                int num12 = Convert.ToInt32(strArray[5]);
                SqlDataAdapter adapter4 = new SqlDataAdapter(strSql + " and RubricType='F'", selectConnection);
                adapter4.Fill(dataSet, "FExamData");
                int num13 = dataSet.Tables["FExamData"].Rows.Count;
                while (flag)
                {
                    if (num12 == 0)
                    {
                        break;
                    }
                    int num14 = random.Next(num13);
                    string str19 = dataSet.Tables["FExamData"].Rows[num14]["ID"].ToString() + "#";
                    if (str6.IndexOf("#" + str19, 0) == -1)
                    {
                        str6 = str6 + str19;
                        num12--;
                    }
                }
                dataSet.Tables.Clear();
                adapter4.Dispose();
            }
            if (Convert.ToInt32(strArray[6]) > 0)
            {
                int num9 = Convert.ToInt32(strArray[6]);
                SqlDataAdapter adapter3 = new SqlDataAdapter(strSql + " and RubricType='G'", selectConnection);
                adapter3.Fill(dataSet, "GExamData");
                int num10 = dataSet.Tables["GExamData"].Rows.Count;
                while (flag)
                {
                    if (num9 == 0)
                    {
                        break;
                    }
                    int num11 = random.Next(num10);
                    string str17 = dataSet.Tables["GExamData"].Rows[num11]["ID"].ToString() + "#";
                    if (str7.IndexOf("#" + str17, 0) == -1)
                    {
                        str7 = str7 + str17;
                        num9--;
                    }
                }
                dataSet.Tables.Clear();
                adapter3.Dispose();
            }
            if (Convert.ToInt32(strArray[7]) > 0)
            {
                int num6 = Convert.ToInt32(strArray[7]);
                SqlDataAdapter adapter2 = new SqlDataAdapter(strSql + " and RubricType='H'", selectConnection);
                adapter2.Fill(dataSet, "HExamData");
                int num7 = dataSet.Tables["HExamData"].Rows.Count;
                while (flag)
                {
                    if (num6 == 0)
                    {
                        break;
                    }
                    int num8 = random.Next(num7);
                    string str15 = dataSet.Tables["HExamData"].Rows[num8]["ID"].ToString() + "#";
                    if (str8.IndexOf("#" + str15, 0) == -1)
                    {
                        str8 = str8 + str15;
                        num6--;
                    }
                }
                dataSet.Tables.Clear();
                adapter2.Dispose();
            }
            if (Convert.ToInt32(strArray[8]) > 0)
            {
                int num3 = Convert.ToInt32(strArray[8]);
                SqlDataAdapter adapter = new SqlDataAdapter(strSql + " and RubricType='I'", selectConnection);
                adapter.Fill(dataSet, "IExamData");
                int num4 = dataSet.Tables["IExamData"].Rows.Count;
                while (flag)
                {
                    if (num3 == 0)
                    {
                        break;
                    }
                    int num5 = random.Next(num4);
                    string str13 = dataSet.Tables["IExamData"].Rows[num5]["ID"].ToString() + "#";
                    if (str9.IndexOf("#" + str13, 0) == -1)
                    {
                        str9 = str9 + str13;
                        num3--;
                    }
                }
                dataSet.Tables.Clear();
                adapter.Dispose();
            }
            dataSet.Clear();
            dataSet.Dispose();
            selectConnection.Close();
            selectConnection.Dispose();
            string str12 = "";
            if (this.txtRubricJSum.Text.Trim() != "0")
            {
                str12 = this.txtRubricJSum.Text.Trim().Replace("_", "#") + "#";
            }
            if (str.Length <= 1)
            {
                str = "";
            }
            else
            {
                str = str.Substring(1);
            }
            if (str2.Length <= 1)
            {
                str2 = "";
            }
            else
            {
                str2 = str2.Substring(1);
            }
            if (str3.Length <= 1)
            {
                str3 = "";
            }
            else
            {
                str3 = str3.Substring(1);
            }
            if (str4.Length <= 1)
            {
                str4 = "";
            }
            else
            {
                str4 = str4.Substring(1);
            }
            if (str5.Length > 1)
            {
                str5 = str5.Substring(1);
            }
            else
            {
                str5 = "";
            }
            if (str6.Length <= 1)
            {
                str6 = "";
            }
            else
            {
                str6 = str6.Substring(1);
            }
            if (str7.Length > 1)
            {
                str7 = str7.Substring(1);
            }
            else
            {
                str7 = "";
            }
            if (str8.Length <= 1)
            {
                str8 = "";
            }
            else
            {
                str8 = str8.Substring(1);
            }
            if (str9.Length <= 1)
            {
                str9 = "";
            }
            else
            {
                str9 = str9.Substring(1);
            }
            strSql = string.Concat(new object[] { "Insert into PaperData(UserCode,PaperID,RubricS,RubricD,RubricB,RubricF,RubricA,RubricC,RubricT,RubricAN,RubricO,RubricJ,SortInfo) values('", this.httpCookie_0.Value, "',", int_0 });
            strSql = strSql + ",'" + str + "','" + str2 + "','" + str3 + "','" + str4 + "','" + str5 + "','" + str6 + "','" + str7 + "','" + str8 + "','" + str9 + "','" + str12 + "','ID#ID#ID#ID#ID#ID#ID#ID#ID#ID')";
            if (this.publicFun_0.ExecuteSql(strSql) == 0)
            {
                return 1;
            }
            this.publicFun_0.ExecuteSql(string.Concat(new object[] { "Insert into ExamUser(UserCode,PaperID,ExamName,Subject,GetOldCountFen,GetCountFen,ExamType,Flag,LastTime) values('", this.httpCookie_0.Value, "',", int_0, ",'", this.txtExamName.Text.Trim(), "','", this.strSubjectName.Trim(), "','0','0','C','A','", this.txtExamTime.Text.Trim(), "')" }));
            return 0;
        }

        private void method_3()
        {
            this.strSubjectName = base.Request.Form["txtSubjectName"].ToString().Trim();
            this.strSubjectID = base.Request.Form["txtSubjectID"].ToString().Trim();
            string[] strArray = this.strSubjectID.Split(new char[] { ',' });
            string str = "";
            for (int i = 0; i < strArray.Length; i++)
            {
                if (strArray[i].Trim() != "")
                {
                    if (str.Trim().Length == 0)
                    {
                        str = " (SubjectID='" + strArray[i].Trim() + "' ";
                    }
                    else
                    {
                        str = str + " or SubjectID='" + strArray[i].Trim() + "' ";
                    }
                }
            }
            if (!(str.Trim() != ""))
            {
                str = " ID<>0 ";
            }
            else
            {
                str = str + ")";
            }
            if (strArray.Length > 0)
            {
                this.labSumA.Text = "题库共<font color=red>" + this.publicFun_0.GetValues("select count(*) as RubricCount from RubricInfo where RubricType='A' and Flag='C' and ISCheck='N' and IsDel='N' and  " + str + " and (IsShare='A' or (IsShare='B' and CreatNumberNO='" + this.httpCookie_0.Value.Trim() + "'))", "RubricCount") + "</font>道";
                this.labSumB.Text = "题库共<font color=red>" + this.publicFun_0.GetValues("select count(*) as RubricCount from RubricInfo where RubricType='B' and Flag='C' and ISCheck='N' and IsDel='N' and  " + str + " and (IsShare='A' or (IsShare='B' and CreatNumberNO='" + this.httpCookie_0.Value.Trim() + "'))", "RubricCount") + "</font>道";
                this.labSumC.Text = "题库共<font color=red>" + this.publicFun_0.GetValues("select count(*) as RubricCount from RubricInfo where RubricType='C' and Flag='C' and ISCheck='N' and IsDel='N' and  " + str + " and (IsShare='A' or (IsShare='B' and CreatNumberNO='" + this.httpCookie_0.Value.Trim() + "'))", "RubricCount") + "</font>道";
                this.labSumD.Text = "题库共<font color=red>" + this.publicFun_0.GetValues("select count(*) as RubricCount from RubricInfo where RubricType='D' and Flag='C' and ISCheck='N' and IsDel='N' and  " + str + " and (IsShare='A' or (IsShare='B' and CreatNumberNO='" + this.httpCookie_0.Value.Trim() + "'))", "RubricCount") + "</font>道";
                this.labSumE.Text = "题库共<font color=red>" + this.publicFun_0.GetValues("select count(*) as RubricCount from RubricInfo where RubricType='E' and Flag='C' and ISCheck='N' and IsDel='N' and  " + str + " and (IsShare='A' or (IsShare='B' and CreatNumberNO='" + this.httpCookie_0.Value.Trim() + "'))", "RubricCount") + "</font>道";
                this.labSumF.Text = "题库共<font color=red>" + this.publicFun_0.GetValues("select count(*) as RubricCount from RubricInfo where RubricType='F' and Flag='C' and ISCheck='N' and IsDel='N' and  " + str + " and (IsShare='A' or (IsShare='B' and CreatNumberNO='" + this.httpCookie_0.Value.Trim() + "'))", "RubricCount") + "</font>道";
                this.labSumG.Text = "题库共<font color=red>" + this.publicFun_0.GetValues("select count(*) as RubricCount from RubricInfo where RubricType='G' and Flag='C' and ISCheck='N' and IsDel='N' and  " + str + " and (IsShare='A' or (IsShare='B' and CreatNumberNO='" + this.httpCookie_0.Value.Trim() + "'))", "RubricCount") + "</font>道";
                this.labSumH.Text = "题库共<font color=red>" + this.publicFun_0.GetValues("select count(*) as RubricCount from RubricInfo where RubricType='H' and Flag='C' and ISCheck='N' and IsDel='N' and  " + str + " and (IsShare='A' or (IsShare='B' and CreatNumberNO='" + this.httpCookie_0.Value.Trim() + "'))", "RubricCount") + "</font>道";
                this.labSumI.Text = "题库共<font color=red>" + this.publicFun_0.GetValues("select count(*) as RubricCount from RubricInfo where RubricType='I' and Flag='C' and ISCheck='N' and IsDel='N' and  " + str + " and (IsShare='A' or (IsShare='B' and CreatNumberNO='" + this.httpCookie_0.Value.Trim() + "'))", "RubricCount") + "</font>道";
                this.labSumJ.Text = "题库共<font color=red>" + this.publicFun_0.GetValues("select count(*) as RubricCount from RubricInfo where RubricType='J' and Flag='C' and ISCheck='N' and IsDel='N' and  " + str + " and (IsShare='A' or (IsShare='B' and CreatNumberNO='" + this.httpCookie_0.Value.Trim() + "'))", "RubricCount") + "</font>道";
            }
            else
            {
                this.labSumA.Text = "题库共<font color=red>0</font>道";
                this.labSumB.Text = "题库共<font color=red>0</font>道";
                this.labSumC.Text = "题库共<font color=red>0</font>道";
                this.labSumD.Text = "题库共<font color=red>0</font>道";
                this.labSumE.Text = "题库共<font color=red>0</font>道";
                this.labSumF.Text = "题库共<font color=red>0</font>道";
                this.labSumG.Text = "题库共<font color=red>0</font>道";
                this.labSumH.Text = "题库共<font color=red>0</font>道";
                this.labSumI.Text = "题库共<font color=red>0</font>道";
                this.labSumJ.Text = "题库共<font color=red>0</font>道";
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            this.httpCookie_0 = new HttpCookie("ExamUserCode");
            this.httpCookie_0 = base.Request.Cookies["ExamUserCode"];
            this.httpCookie_1 = new HttpCookie("ExamUserName");
            this.httpCookie_1 = base.Request.Cookies["ExamUserName"];
            this.httpCookie_2 = new HttpCookie("ExamUserLevel");
            this.httpCookie_2 = base.Request.Cookies["ExamUserLevel"];
            this.httpCookie_3 = new HttpCookie("ExamDeptID");
            this.httpCookie_3 = base.Request.Cookies["ExamDeptID"];
            if ((this.httpCookie_0 != null) ? !(this.httpCookie_0.Value == "") : false)
            {
                base.Response.Cache.SetCacheability(HttpCacheability.NoCache);
                base.Response.Cache.SetNoStore();
                this.httpCookie_0.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_0.Value));
                this.httpCookie_1.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_1.Value));
                this.httpCookie_2.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_2.Value));
                this.httpCookie_3.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_3.Value));
                if (base.IsPostBack)
                {
                    this.strSubjectName = base.Request.Form["txtSubjectName"].ToString().Trim();
                    this.strSubjectID = base.Request.Form["txtSubjectID"].ToString().Trim();
                    this.txtRubricJSum.Text = base.Request.Form["txtRubricJSum"].ToString().Trim();
                    this.txtRubricJFen.Text = base.Request.Form["txtRubricJFen"].ToString().Trim();
                    this.txtSumJRubricType.Text = base.Request.Form["txtSumJRubricType"].ToString().Trim();
                }
                else if (this.publicFun_0.ReturnPaperData() != "Yes")
                {
                    ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BCheck", "alert('此版本暂未授权,请与管理员联系！')", true);
                }
                else
                {
                    string str = this.publicFun_0.GetValues("select ParmValue from SysParmInfo where ParmMemo='IsTestPaper'", "ParmValue").Trim();
                    this.Page.Title = ConfigurationManager.ConnectionStrings["ProTitle"].ConnectionString;
                    if (!(str != "Y"))
                    {
                        this.butDefault.Attributes.Add("onclick", "javascript:{if(confirm('确定试卷参数无误，并生成试卷吗？')==false) return false;}");
                        this.method_0();
                        this.txtStartDate.Text = DateTime.Now.ToString("yyyy-MM-dd");
                        this.txtEndDate.Text = DateTime.Now.AddDays(1.0).ToString("yyyy-MM-dd");
                        this.method_1();
                    }
                    else
                    {
                        this.butDefault.Enabled = false;
                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BCheck", "alert('自定义模拟试卷权限未开放！')", true);
                    }
                }
            }
            else
            {
                base.Response.Write("<script language=javascript>top.location.href='../Index.htm';self.close();</script>");
            }
        }
    }
}

